<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	May 17, 2010
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/packages.php
 ^ 
 * Description: template view packages
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
 
 global $mainframe;
 $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=purchasehistory&Itemid='.$this->Itemid;
 $document =& JFactory::getDocument();
 $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
   
?>
<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td class="curloc">
		<?php echo JText::_('JS_CUR_LOC'); ?> : <?php echo JText::_('JS_PURCHASE_HISTORY'); ?>
	</td></tr>
	<?php } ?>
	<tr nowrap><td >
	<?php 
			if (sizeof($this->jobseekerlinks) != 0){
				echo '<div id="toplinks"><ul>';
				foreach($this->jobseekerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div>';			
			} 
		?>
	</td></tr>	
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_PURCHASE_HISTORY'); ?>
	</td></tr>
	<tr><td height="3"></td></tr>
</table>


<?php
if ($this->userrole->rolefor == 2) { // jobseeker

if (isset($this->packages)) {

?>

	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
		<?php 
		$tdclass = array($this->theme['odd'], $this->theme['even']);
		$isodd =1;
		if ( isset($this->packages) ){
		foreach($this->packages as $package)	{ 
		$isodd = 1 - $isodd; ?>
		<tr height="20" class="<?php echo $tdclass[$isodd]; ?>" > <td colspan="5">
                        <table cellpadding="0" cellspacing="0" border="0" width="100%" ><tr><td>
                            <table cellpadding="0" cellspacing="1" border="0" width="100%">
                                    <tr><td height="3"></td></tr>
                                    <tr >
                                            <td colspan="4" height="25" align="center" class="sectionheadline"><strong><font size="2">
                                           	<a  href="index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=package_details&gd=<?php echo $package->id; ?>&Itemid=<?php echo $this->Itemid; ?>"><strong><?php echo $package->title; ?></strong></a></font>
                                            </td>
                                    </tr>
                                    <tr>
                                            <td width="20%">&nbsp;<strong><?php echo JText::_('JS_RESUME_ALLOWED'); ?>	</strong></td>
                                            <td width="30%"><?php if($package->resumeallow == -1) echo JText::_('JS_UNLIMITED'); else echo $package->resumeallow; ?></td>
                                            <td width="20%">&nbsp;<strong><?php echo JText::_('JS_COVERLETTERS_ALLOWED'); ?></strong></td>
                                            <td width="30%"><?php if($package->coverlettersallow == -1) echo JText::_('JS_UNLIMITED'); else echo $package->coverlettersallow; ?></td>
                                    </tr>
									 <tr>
                                            <td width="20%">&nbsp;<strong><?php echo JText::_('JS_PACKAGE_EXPIRE_IN_DAYS'); ?>	</strong></td>
                                            <td width="30%"><?php echo $package->packageexpireindays; ?></td>
                                            <td width="20%">&nbsp;<strong><?php echo JText::_('JS_PAID_AMOUNT'); ?></strong></td>
                                            <td width="30%"><?php if ($package->paidamount !=0) echo $this->config['currency'].$package->paidamount;else echo $package->paidamount; ?></td>
                                    </tr>
                                    <tr>
                                            <td width="20%">&nbsp;<strong><?php echo JText::_('JS_PAYMENT'); ?>	</strong></td>
                                            <td width="30%"><?php if($package->transactionverified == 1) echo JText::_('JS_VERIFIED'); else echo '<strong>'.JText::_('JS_NOT_VERIFIED').'</strong>'; ?></td>
                                            <td width="20%">&nbsp;<strong><?php echo JText::_('JS_BUY_DATE'); ?></strong></td>
											<td width="30%"><?php echo date($this->config['date_format'],strtotime($package->created)); ?></td>
                                    </tr>
                                   
                                    <tr><td height="3"></td></tr>
                            </table>
                        </td></tr></table>
		</td></tr>
		<?php
		}
		} ?>		
	</table>
	<form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=purchasehistory&Itemid='.$this->Itemid); ?>" method="post">
	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
    <tr>
        <td></td>
        <td >
            <?php
            echo $this->pagination->getPagesLinks();
            ?>
        </td>
    </tr>
    <tr>
        <td align="left">
            <?php echo JText::_('JS_DISPLAY_#'); ?>
            <?php
            echo $this->pagination->getLimitBox();
            ?>
        </td>
        <td align="right">
            <?php
            echo $this->pagination->getResultsCounter();
            ?>
        </td>
    </tr>
	</table>
	</form>	<?php
}else{ // no result found in this category
	echo JText::_('JS_RESULT_NOT_FOUND');
}

} else{ // not allowed job posting
echo JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW');
}	
}//ol
?>	
<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>



